package com.example.drss.fragment;


import java.util.Collection;

import com.example.drss.AboutActivity;
import com.example.drss.CollectionActivity;
import com.example.drss.DRSSActivity;
import com.example.drss.R;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

public class FourFragment extends Fragment {
	
	DRSSActivity activity;
	Button userButton;
	Button collectionButton;
	Button aboutButton;
	
	OnClickListener listener=new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			switch (v.getId()) {
			case R.id.button_user_now:
				
				break;
			case R.id.button_collection:
				Intent intent=new Intent(activity,CollectionActivity.class);
				intent.putExtra("databasePath_collection", activity.databasePath);
				startActivity(intent);
				break;
			case R.id.button_about:
				Intent intent2=new Intent(activity,AboutActivity.class);
				startActivity(intent2);
				break;

			default:
				break;
			}
		}
	};
	
	public View onCreateView(LayoutInflater inflater,
			@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View view=inflater.inflate(R.layout.fragment_four, container, false);
		activity=(DRSSActivity)getActivity();
		userButton=(Button)view.findViewById(R.id.button_user_now);
		collectionButton=(Button)view.findViewById(R.id.button_collection);
		aboutButton=(Button)view.findViewById(R.id.button_about);
		userButton.setText("  "+activity.user);
		userButton.setOnClickListener(listener);
		collectionButton.setOnClickListener(listener);
		aboutButton.setOnClickListener(listener);
		
		return view;
	}
	
	
}
